package cn.ekuma.epos.analysis.finance.model;

import com.openbravo.bean.erp.viewbean.FinanceChargeAnysisInfo;
import com.openbravo.format.Formats;
import com.openbravo.pos.base.AppLocal;

import cn.ekuma.data.ui.swing.AbstractDTOTableModel;
import cn.ekuma.epos.businesslogic.OrderUtil;


public class FinanceChargeAnysisTableModel extends AbstractDTOTableModel<FinanceChargeAnysisInfo> {

	@Override
	public Object getValueAt(int rowIndex, int columnIndex) {
		FinanceChargeAnysisInfo orderInfo=this.getObj(rowIndex);
		switch(columnIndex){
        case 0:
            return orderInfo.getDefineType();
        case 1:
            return orderInfo.getOrdertype()==0?OrderUtil.ORDERTYPE_Normal:OrderUtil.ORDERTYPE_Revoerse;
        case 2:
            return orderInfo.getUnit();
        case 3:
              return Formats.CURRENCY.formatValue(orderInfo.getTotalPrice());
        case 4:
            return Formats.CURRENCY.formatValue(orderInfo.getConsultCost());
        case 5:
        	  return Formats.CURRENCY.formatValue(orderInfo.getDebt());
        case 6:
      	      return Formats.CURRENCY.formatValue(orderInfo.getTotalPrice()-orderInfo.getConsultCost());
    }
    return null;
	}

	@Override
	public String[] getColumnNames() {
		return new String[]{
                AppLocal.getIntString("label.ordertype"),
                AppLocal.getIntString("label.ordertypedialog.bearing"), 
                AppLocal.getIntString("label.units"),
                AppLocal.getIntString("label.totalcash"),
                AppLocal.getIntString("label.ordertype.consultPriceType"),
                AppLocal.getIntString("label.curdebt"),
                AppLocal.getIntString("label.totalcash")+"-"+AppLocal.getIntString("label.ordertype.consultPriceType")
             };
	}
}
